<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>{$sys.name}</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="__PUBLIC__/resource/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="//cdn.bootcss.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="//cdn.bootcss.com/ionicons/2.0.1/css/ionicons.min.css">
    <!-- DataTables -->
    <link rel="stylesheet" href="__PUBLIC__/resource/plugins/datatables/dataTables.bootstrap.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="__PUBLIC__/resource/dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="__PUBLIC__/resource/dist/css/skins/_all-skins.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- jQuery 2.1.4 -->
    <script src="__PUBLIC__/resource/plugins/jQuery/jQuery-2.1.4.min.js"></script>

    <!-- Bootstrap 3.3.5 -->
    <script src="__PUBLIC__/resource/bootstrap/js/bootstrap.min.js"></script>
    <!-- DataTables -->
    <script src="__PUBLIC__/resource/plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="__PUBLIC__/resource/plugins/datatables/dataTables.bootstrap.min.js"></script>
    <!-- SlimScroll -->
    <script src="__PUBLIC__/resource/plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <!-- FastClick -->
    <script src="__PUBLIC__/resource/plugins/fastclick/fastclick.min.js"></script>

    <!-- bootstrap datetimepicker -->
    <link rel="stylesheet" href="__PUBLIC__/resource/plugins/datetimepicker/bootstrap-datetimepicker.css">
    <script src="__PUBLIC__/resource/plugins/datetimepicker/bootstrap-datetimepicker.js"></script>
    <script src="__PUBLIC__/resource/plugins/datetimepicker/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>

    <!-- datePicker -->
    <link rel="stylesheet" href="__PUBLIC__/resource/script/jquery-plugins/datePicker/datePicker.css">
    <script src="__PUBLIC__/resource/script/jquery-plugins/datePicker/datePicker.js"></script>

    <!-- Bootstrap Dialog -->
    <link href="__PUBLIC__/resource/plugins/bootstrap-dialog/bootstrap-dialog.css" rel="stylesheet" type="text/css" />
    <script src="__PUBLIC__/resource/plugins/bootstrap-dialog/bootstrap-dialog.js"></script>
    <script src="__PUBLIC__/resource/plugins/bootstrap-dialog/bootstrap-dialog-const.js"></script>
    <script type="text/javascript">BootstrapDialog.configDefaultOptions({nl2br:false});</script>

    <!-- AdminLTE App -->
    <script src="__PUBLIC__/resource/dist/js/app.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="__PUBLIC__/resource/dist/js/demo.js"></script>

    <!-- Admin css -->
    <link rel="stylesheet" href="__PUBLIC__/resource/style/admin.css">

    <!-- jQuery plugins -->
    <script src="__PUBLIC__/resource/plugins/cookie/jquery.cookie.js"></script>
    <script src="__PUBLIC__/resource/plugins/zTree/jquery.ztree.all-3.5.min.js"></script>

    <!-- Hightlight -->
    <link rel="stylesheet" href="__PUBLIC__/resource/script/highlight/styles/default.css">
    <script src="__PUBLIC__/resource/script/highlight/highlight.pack.js"></script>

    <!-- Bootstrap Markdown -->
    <link href="__PUBLIC__/resource/plugins/bootstrap-markdown/bootstrap-markdown.min.css" rel="stylesheet" type="text/css" />
    <!--
    <script src="__PUBLIC__/resource/plugins/bootstrap-markdown/markdown.js"></script>
    <script src="__PUBLIC__/resource/plugins/bootstrap-markdown/to-markdown.js"></script>
    -->
    <script src="__PUBLIC__/resource/plugins/bootstrap-markdown/marked.js"></script>
    <script src="__PUBLIC__/resource/plugins/bootstrap-markdown/marked.js"></script>
    <script src="__PUBLIC__/resource/plugins/bootstrap-markdown/bootstrap-markdown.js"></script>
    <script src="__PUBLIC__/resource/plugins/bootstrap-markdown/bootstrap-markdown.zh.js"></script>
    <script src="__PUBLIC__/resource/script/jquery-plugins/jquery-hotkeys/jquery.hotkeys.js"></script>

    <!-- Admin.js -->
    <script src="__PUBLIC__/resource/script/admin.js"></script>
</head>

<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

    <header class="main-header">
        <!-- Logo -->
        <a href="#" class="logo">
            <!-- mini logo for sidebar mini 50x50 pixels -->
            <span class="logo-mini"><b>菜单</b></span>
            <!-- logo for regular state and mobile devices -->
            <span class="logo-lg"><b>控制面板</b></span>
        </a>
        <!-- Header Navbar: style can be found in header.less -->
        <nav class="navbar navbar-static-top" role="navigation">
            <!-- Sidebar toggle button-->
            <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </a>
            <div id="navbar-collapse" class="collapse navbar-collapse pull-left">
                <ul class="nav navbar-nav">
                    <li data-id="x" class="active"><a href="javascript:showMenu('x')">常用</a></li>
                    <volist name="sysmenu" id="n">
                        <li data-id="{$n.nid}"><a href="javascript:showMenu({$n.nid})">{$n.title}</a></li>
                    </volist>
                </ul>
            </div>
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <!-- User Account: style can be found in dropdown.less -->
                    <li class="dropdown user user-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <img src="__PUBLIC__/resource/dist/img/avatar-120x120.png" class="user-image" alt="User Image">
                            <span class="hidden-xs">{$userInfo.username}</span>
                        </a>
                        <ul class="dropdown-menu">
                            <!-- User image -->
                            <li class="user-header">
                                <img src="__PUBLIC__/resource/dist/img/avatar-120x120.png" class="img-circle" alt="User Image">
                                <p>
                                    {$userInfo.username} - {$userInfo.rname}
                                    <small>注册时间： {$userInfo.regtime|std_date}</small>
                                </p>
                            </li>
                            <!-- Menu Footer-->
                            <li class="user-footer">
                                <div class="pull-left">
                                    <a href="{:U('Profile/profile')}" class="btn btn-default btn-flat">修改资料</a>
                                </div>
                                <div class="pull-right">
                                    <a href="{:U('Public/logout')}" class="btn btn-default btn-flat">注销</a>
                                </div>
                            </li>
                        </ul>
                    </li>
                    <!-- Control Sidebar Toggle Button -->
                    <li>
                        <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
                    </li>
                </ul>
            </div>
        </nav>
    </header>

    <!-- Left side column. contains the logo and sidebar -->
    <aside class="main-sidebar">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
            <!-- Sidebar user panel -->
            <div class="user-panel">
                <div class="pull-left image">
                    <img src="__PUBLIC__/resource/dist/img/avatar-120x120.png" class="img-circle" alt="User Image">
                </div>
                <div class="pull-left info">
                    <p>{$userInfo.username}</p>
                    <a href="#"><i class="fa fa-circle text-success"></i> {$userInfo.rname}</a>
                </div>
            </div>
            <!-- sidebar menu: : style can be found in sidebar.less -->
            <ul class="sidebar-menu">

                <!--<include file='../Public/menu.html'/>-->

                <!--
                <li class="header">OTHERS</li>
                <li><a href="#"><i class="fa fa-book"></i> <span>技术支持</span></a></li>
                -->
            </ul>
        </section>
        <!-- /.sidebar -->
    </aside>
    <script>
        /* 菜单显示 */
        function showMenu(n) {
            var hash = location.hash ? location.hash.replace('#','') : '';
            if(!hash) {
                hash = getCookie('hash');
            }
            hash = hash ? hash : '';
            setCookie('hash', hash);
            var menuid = '';
            if(hash.indexOf('menuid-') === 0) {
                menuid = hash.replace('menuid-','').split('-');
                if(menuid.length==0) {
                    menuid = '';
                }
            }
            if(!n && menuid) {
                n = menuid[menuid.length-1];
            }
            n = n || '';
            var url = '{:U('Public/menu', array('menuid'=>''))}' + n;
            $.ajax({
                url: url,
                data: {},
                type: 'GET',
                cache: false,
                dataType: "text",
                success: function (str) {
                    $('.sidebar-menu').html(str);
                    if(menuid) {
                        var p = $('.sidebar-menu');
                        p.find('li').removeClass('active');
                        p.find('ul').removeClass('menu-open');
                        for (var i in menuid) {
                            var e = p.find('li[data-id='+ menuid[i] +']');
                            if(e.length) {
                                e.addClass('active');
                                if(e.children('ul').length) {
                                    e.children('ul').addClass('menu-open');
                                }
                            }
                        }
                    }
                }
            });
            if(n) {
                var p = $('.navbar-nav');
                p.find('li').removeClass('active');
                p.find('li[data-id='+n+']').addClass('active');
            }
        }
        $(function() {
            showMenu();
        });
    </script>